package com.zhou.app.favourite.controller.security;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xianfeng
 * @date 2023/5/13 8:30
 */
@Api(tags = "测试模块")
@ApiSupport(order = 1)
@RestController
public class MyController {

    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "新增收藏接口")
    @PreAuthorize("hasRole('ADMIN')")
    @RequestMapping("/test1")
    public String test1(Model model) {
        return "hasRole('ADMIN')";
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "新增收藏接口")
    @PreAuthorize("hasAuthority('system')")
    @RequestMapping("/test2")
    public String test2(Model model) {
        return "hasAuthority('system')";
    }

    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "新增收藏接口")
    @RequestMapping("/test3")
    public String test3(Model model) {
        return "hasAuthority('system')";
    }
}
